package com.wondersgroup.fjzlpt.yyzyzx.dao.impl.yyzygl.yysz;

import com.wondersgroup.fjzlpt.yyzyzx.dao.inter.yyzygl.yysz.BhcxmDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import com.alibaba.fastjson.JSONArray;
import com.quick.framework.boot.repository.sql.bean.SQLBean;
import com.quick.framework.boot.repository.sql.bean.table.TableBean;
import com.quick.framework.boot.repository.sql.jdbcTemplate.impl.BaseJTDAOImpl;

@Repository
public class BhcxmDaoImpl extends BaseJTDAOImpl implements BhcxmDao {

	@Override
	@Autowired
	@Qualifier("TB_YYZY_BHCXM")
	public void setTb(TableBean tb){
		super.setTb(tb);
	}

	/**
	 * 根据"规则编号"删除相关记录
	 * @param GZBH
	 */
	@Override
	public void deleteByGzbh(String GZBH) {
		StringBuffer sqlBuf = new StringBuffer();
		sqlBuf.append("delete from ").append(this.tb.getTableName()).append(" where GZBH = ?");
		
		SQLBean bean = new SQLBean(sqlBuf.toString(), GZBH);
		super.update(bean);
	}

	/**
	 * 根据'规则编号'查询相关记录
	 * @param GZBH
	 * @return
	 */
	@Override
	public JSONArray queryByGzbh(String GZBH) {
		StringBuffer sqlBuf = new StringBuffer();
		sqlBuf.append("select * from ").append(this.tb.getTableName()).append(" where GZBH = ?");
		SQLBean bean = new SQLBean(sqlBuf.toString(), GZBH);
		return super.queryList(bean);
	}
}
